﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ReconSite.Master" AutoEventWireup="true" 
CodeBehind="RoleMenuMapping.aspx.cs" Inherits="ReconUI.RoleMenuMapping" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleHolder" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyHolder" runat="server">
     <div class="formDiv" style="width:45%">
    <h2 class="formTitle">Role Menu Mapping</h2>
    <h1 class="formError" style="text-align:right;font-size:smaller;color:#CC2900;">Fields marked with * are mandatory</h1>
	<%--<span id="mandatoryMessage" class="formError">Fields marked with * are mandatory</span>--%>
<table cellspacing="1" cellpadding="1" border="0" width="100%">
            
            <tr>
                <td align="right">
                    Role<span class="required">*</span>
                </td>
                <td colspan="3">
                    <asp:DropDownList ID="ddlRole" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="ddlRole_SelectedIndexChanged">
                    </asp:DropDownList>
                    <%--<asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_Click" />--%>
                    <asp:RequiredFieldValidator ID="reqDdlRole" runat="server" ControlToValidate="ddlRole" 
                        InitialValue="0" ErrorMessage="Select Role" SetFocusOnError="True" 
                        CssClass="formError"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right">
                    &nbsp;
                </td>
                <td colspan="3">
                    &nbsp;&nbsp;
                    <asp:GridView ID="grvMenu" runat="server" AutoGenerateColumns="false" DataKeyNames="Menu_ID">
                        <Columns>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <input id="chkSelectAll" type="checkbox"  name="SelectAllCheckBox" onclick="javascript:SelectAllStatement(this)" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <input id="chkIndividual" type="checkbox" style="azimuth:center" runat="server" />
                                </ItemTemplate>
                               <%--   <HeaderStyle HorizontalAlign="Left" />
                                <ItemStyle HorizontalAlign="Left" /> --%>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Menu">
                                <ItemTemplate>
                                    <asp:Label ID="txtMenu" runat="server" Text='<%# Eval("menu_name") %>'></asp:Label>
                                    <asp:HiddenField ID="hdnMenuID" runat="server" Value='<%# Eval("menu_id") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td align="right">
                    &nbsp;
                </td>
                <td colspan="3">
                    &nbsp;
                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="Button" OnClick="btnSubmit_Click" />
                </td>
            </tr>
        </table>

<asp:UpdatePanel ID="upUnmatchedLists" runat="server" UpdateMode="Conditional">
        <ContentTemplate>    
                <div id="pnlMatchList" runat="server" class="pnlMatchList">    
                    <span style="azimuth: center;">
                        <div id="Div1" class="formDiv" runat ="server"  >
                            <center>
                                <asp:Label ID="lblMessage" runat="server"    CssClass="lable"/>
                            </center>
                        </div>
                    </span>
                    <div class="formDiv" style="width: 30%;">
                         <center>
                            <asp:Button ID="btnok" runat="server" Text="OK" onclick="btnok_Click" CausesValidation="False"  />
                          </center>
                    </div>
                </div>
            <div style="display: none">
                <asp:Button ID="btnManualPopup" runat="server" />
            </div>
            <ajax:ModalPopupExtender ID="btnClickPopup" runat="server" PopupControlID="pnlMatchList"
                TargetControlID="btnManualPopup" BackgroundCssClass="modalBackground" RepositionMode="RepositionOnWindowScroll" OkControlID = "btnok">
            </ajax:ModalPopupExtender>   
        </ContentTemplate>        
    </asp:UpdatePanel>
</div>
<script type="text/javascript">
    function SelectAllStatement(CheckBoxControl) {         
         if (CheckBoxControl.checked == true) {
             var i;
             for (i = 0; i < document.forms[0].elements.length; i++) {
                 if ((document.forms[0].elements[i].type == 'checkbox') && (document.forms[0].elements[i].name.indexOf('grvMenu') > -1)) {
                     document.forms[0].elements[i].checked = true;
                 }
             }
         }
         else {
             var i;
             for (i = 0; i < document.forms[0].elements.length; i++) {
                 if ((document.forms[0].elements[i].type == 'checkbox') &&
                    (document.forms[0].elements[i].name.indexOf('grvMenu') > -1)) {
                     document.forms[0].elements[i].checked = false;
                 }
             }
         }
     }
    </script>
</asp:Content>
